package com.xueyu.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xueyu.domain.HouseBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface HouseDao extends BaseMapper<HouseBean> {
    @Select("SELECT h.*, c.communityName FROM house h LEFT JOIN community c ON h.communityId = c.communityId ${ew.customSqlSegment}")
    List<HouseBean> selectLeftJoin(@Param(Constants.WRAPPER) QueryWrapper<HouseBean> queryWrapper,Page<HouseBean> page);

    @Select("SELECT h.*, c.communityName FROM house h LEFT JOIN community c ON h.communityId = c.communityId WHERE h.contact LIKE '%${search}%'" +
            " OR c.communityName LIKE '%${search}%'")
    Page<HouseBean> house(@Param("search") String search, Page<HouseBean> page);

    List<HouseBean> houseList_left_term();

}
